package com.le.tester.tip.list2tree;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * createTime：2022/9/21 13:46
 * description：测试类
 */
public class Tester {
    public static void main(String[] args) {
        List<TestEntity> entityList = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            TestEntity testEntity = new TestEntity();
            testEntity.setMaterialUrl("www.baidu" + i + ".com");
            testEntity.setProdName("产品名称");
            testEntity.setTicketId(7111L);
            entityList.add(testEntity);
        }

        for (int i = 0; i < 3; i++) {
            TestEntity testEntity = new TestEntity();
            testEntity.setMaterialUrl("www.baidu" + i + ".com");
            testEntity.setProdName("产品名称");
            testEntity.setTicketId(7112L);
            entityList.add(testEntity);
        }
        Map<Long, List<TestEntity>> collect = entityList.stream().collect(Collectors.groupingBy(TestEntity::getTicketId));
        System.out.println(collect);
    }
}
